Created: 2022-06-12
Tags: #literature
struct is a datatype
struct StructureName{
datatype member1; // datatype like (int, char)
datatype member2; //
}
There's two different ways we can create struct variables
A BETTER WAY TO define struct
typedef struct StructureName{
// code here
}
variableName // This will be our variable for our structure
Here's how we create structure variables:
struct Person {
// code
};
int main() {
struct Person person1, person2, p[20];
return 0;
}
Another way of creating a struct variable is:
struct Person {
// code
} person1, person2, p[20];